package com.ruanyun.modular.admin.controller;

import com.ruanyun.base.pojo.page.LayuiPageInfo;
import com.ruanyun.modular.admin.entity.TPollutantsFactor;
import com.ruanyun.modular.admin.model.params.TPollutantsFactorParam;
import com.ruanyun.modular.admin.service.TPollutantsFactorService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 污染物信息表控制器
 *
 * @author zs
 * @Date 2021-05-12 14:17:57
 */
@Controller
@RequestMapping("/tPollutantsFactor")
public class TPollutantsFactorController extends BaseController {

    private String PREFIX = "/tMonitoringinfo";

    @Autowired
    private TPollutantsFactorService tPollutantsFactorService;

    /**
     * 跳转到主页面
     *
     * @author zs
     * @Date 2021-05-12
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "/tPollutantsFactor.html";
    }

    /**
     * 新增页面
     *
     * @author zs
     * @Date 2021-05-12
     */
    @RequestMapping("/add")
    public String add() {
        return PREFIX + "/tPollutantsFactor_add.html";
    }

    /**
     * 编辑页面
     *
     * @author zs
     * @Date 2021-05-12
     */
    @RequestMapping("/edit")
    public String edit() {
        return PREFIX + "/tPollutantsFactor_edit.html";
    }

    /**
     * 新增接口
     *
     * @author zs
     * @Date 2021-05-12
     */
    @RequestMapping("/addItem")
    @ResponseBody
    public ResponseData addItem(TPollutantsFactorParam tPollutantsFactorParam) {
        return this.tPollutantsFactorService.add(tPollutantsFactorParam);
    }

    /**
     * 编辑接口
     *
     * @author zs
     * @Date 2021-05-12
     */
    @RequestMapping("/editItem")
    @ResponseBody
    public ResponseData editItem(TPollutantsFactorParam tPollutantsFactorParam) {
        return this.tPollutantsFactorService.update(tPollutantsFactorParam);
    }

    /**
     * 删除接口
     *
     * @author zs
     * @Date 2021-05-12
     */
    @RequestMapping("/delete")
    @ResponseBody
    public ResponseData delete(TPollutantsFactorParam tPollutantsFactorParam) {
        return this.tPollutantsFactorService.updateDelFlagById((long)tPollutantsFactorParam.getId());
    }

    /**
     * 查看详情接口
     *
     * @author zs
     * @Date 2021-05-12
     */
    @RequestMapping("/detail")
    @ResponseBody
    public ResponseData detail(TPollutantsFactorParam tPollutantsFactorParam) {
        TPollutantsFactor detail = this.tPollutantsFactorService.getById(tPollutantsFactorParam.getId());
        return ResponseData.success(detail);
    }

    /**
     * 查询列表
     *
     * @author zs
     * @Date 2021-05-12
     */
    @ResponseBody
    @RequestMapping("/list")
    public LayuiPageInfo list(Integer monitoringId,Integer isOrganization) {
        return this.tPollutantsFactorService.findPageBySpec(monitoringId,isOrganization);
    }

    /**
     * 启用
     *
     * @author zs
     * @Date 2021-05-12
     */
    @ResponseBody
    @RequestMapping("/enable")
    public ResponseData enable(@RequestParam Long id) {
        return this.tPollutantsFactorService.enableById(id);
    }

    /**
     * 禁用
     *
     * @author zs
     * @Date 2021-05-12
     */
    @ResponseBody
    @RequestMapping("/disable")
    public ResponseData disable(@RequestParam Long id) {
        return this.tPollutantsFactorService.disableById(id);
    }




    /**
     * 位置列表
     *
     * @author zs
     * @Date 2021-05-12
     */
    @ResponseBody
    @RequestMapping("/positionEditList")
    public LayuiPageInfo list(Integer monitoringId,Integer isOrganization,Integer isInside) {
        return this.tPollutantsFactorService.findPageBySpecs(monitoringId,isOrganization,isInside);
    }


    /**
     * 添加位置页面
     *
     * @author zs
     * @Date 2021-05-11
     */
    @RequestMapping("/addPositionEdit")
    public String positionEdit() {
        return PREFIX + "/addPositionEdit.html";
    }



    /**
     * 新增接口
     *
     * @author zs
     * @Date 2021-05-12
     */
    @RequestMapping("/addPositionEditInfo")
    @ResponseBody
    public ResponseData addPositionEditInfo(TPollutantsFactorParam tPollutantsFactorParam) {
        return this.tPollutantsFactorService.add(tPollutantsFactorParam);
    }



    /**
     * 编辑污染物因子页面
     *
     * @author zs
     * @Date 2021-05-11
     */
    @RequestMapping("/editPollutantsInfo")
    public String editPollutantsInfo() {
        return PREFIX + "/editPollutantsInfo.html";
    }




    /**
     * 位置污染物因子列表
     *
     * @author zs
     * @Date 2021-05-12
     */
    @ResponseBody
    @RequestMapping("/pollutantsList")
    public LayuiPageInfo pollutantsList(Integer monitoringId,Integer isOrganization,Integer isInside,Integer pid) {
        return this.tPollutantsFactorService.pollutantsList(monitoringId,isOrganization,isInside,pid);


    }

    /**
     * 风向污染物因子列表
     *
     * @author zs
     * @Date 2021-05-12
     */
    @ResponseBody
    @RequestMapping("/pollutantsLists")
    public LayuiPageInfo pollutantsLists(Integer monitoringId,Integer isOrganization,Integer isInside,Integer windType) {
        return this.tPollutantsFactorService.pollutantsLists(monitoringId,isOrganization,isInside,windType);


    }



    /**
     * 添加污染物因子页面
     *
     * @author zs
     * @Date 2021-05-11
     */
    @RequestMapping("/addPollutantsInfo")
    public String addPollutantsInfo() {
        return PREFIX + "/addPollutantsInfo.html";
    }



    /**
     * 添加污染物因子
     *
     * @author zs
     * @Date 2021-05-11
     */
    @RequestMapping("/insertPollutantsInfo")
    @ResponseBody
    public ResponseData insertPollutantsInfo(TPollutantsFactorParam tPollutantsFactorParam) {
        return this.tPollutantsFactorService.add(tPollutantsFactorParam);
    }


    /**
     * 无组织编辑污染物因子页面
     *
     * @author zs
     * @Date 2021-05-11
     */
    @RequestMapping("/positionUpdate")
    public String positionUpdate() {
        return PREFIX + "/positionUpdate.html";
    }

}


